package Task3;
/**
 * 手机卡类
 * 特征：
 * 卡类型、卡号、用户名、密码、账户余额、通话时长（分钟）、上网流量
 *
 * 行为：
 * 显示（卡号 + 用户名 + 当前余额）
 */
public class PhoneCard {

    private String cardClass;   // 卡类型，通过手机卡枚举类赋值
    private int cardId;         // 卡号
    private String userName;    // 用户名
    private String passWord;    // 密码
    private int accountBalance; // 账户余额
    private int talkTime;       // 通话时长(分钟)
    private int netFlow;        // 上网流量

    public PhoneCard() {
    }

    public PhoneCard(String cardClass, int cardId, String userName, String passWord, int accountBalance, int talkTime, int netFlow) {
        setCardClass(cardClass);
        setCardId(cardId);
        setUserName(userName);
        setPassWord(passWord);
        setAccountBalance(accountBalance);
        setTalkTime(talkTime);
        setNetFlow(netFlow);
    }

    public String getCardClass() {
        return cardClass;
    }

    public void setCardClass(String cardClass) {
        this.cardClass = cardClass;
    }

    public int getCardId() {
        return cardId;
    }

    public void setCardId(int cardId) {
        this.cardId = cardId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public int getAccountBalance() {
        return accountBalance;
    }

    public void setAccountBalance(int accountBalance) {
        this.accountBalance = accountBalance;
    }

    public int getTalkTime() {
        return talkTime;
    }

    public void setTalkTime(int talkTime) {
        if(talkTime>=0) {
            this.talkTime = talkTime;
        } else {
            System.out.println("通话时长不合理哦！");
        }
    }

    public int getNetFlow() {
        return netFlow;
    }

    public void setNetFlow(int netFlow) {
        if(netFlow>=0) {
            this.netFlow = netFlow;
        } else {
            System.out.println("上网流量不合理哦！");
        }
    }

    // 自定义成员方法
    void show() {
        System.out.println("PhoneCard手机卡类");
        //System.out.println("卡类型: "+ getCardClass());
        System.out.println("卡号：" + getCardId());
        System.out.println("用户名；" + getUserName());
        System.out.println("账户余额：" + getAccountBalance());
    }
}
